import java.util.Comparator;

public class BoxComparator implements Comparator<Position> 
{

	@Override
	public int compare(Position p0, Position p1) 
	{
		if (p0.getX() < p1.getX()) 
		{
			return -1;
		} 
		else if (p0.getX() > p1.getX()) 
		{
			return 1;
		} 
		else if (p0.getX() == p1.getX()) 
		{
			if (p0.getY() < p1.getY()) 
			{
				return -1;
			} 
			else if (p0.getY() > p1.getY()) 
			{
				return 1;
			}
		}
		return 0;
	}
}